package com.free.beanutils;

import com.free.exception.SystemRuntimeException;

import java.lang.reflect.InvocationTargetException;


/**
 * <p>
 * 功能概述: 
 * </p>
 * <p>
 * 功能详述: 
 * </p>
 */
public class BeanUtils extends org.apache.commons.beanutils.BeanUtils
{

    /*========================================================================*
     *                         Public Fields (公共属性)                                                                
     *========================================================================*/

    /*========================================================================*
     *                         Private Fields (私有属性)                                                                
     *========================================================================*/

    /*========================================================================*
     *                         Construct Methods (构造方法) 
     *========================================================================*/

    /*========================================================================*
     *                         Public Methods (公有方法)                                                                   
     *========================================================================*/

    /**
     * <p>Copy property values from the origin bean to the destination bean
     * for all cases where the property names are the same.</p>
     *
     * <p>For more details see <code>BeanUtilsBean</code>.</p>
     *
     * @param dest Destination bean whose properties are modified
     * @param orig Origin bean whose properties are retrieved
     *
     * @throws IllegalAccessException if the caller does not have
     *  access to the property accessor method
     * @throws IllegalArgumentException if the <code>dest</code> or
     *  <code>orig</code> argument is null or if the <code>dest</code>
     *  property type is different from the source type and the relevant
     *  converter has not been registered.
     * @throws InvocationTargetException if the property accessor method
     *  throws an exception
     * @see BeanUtilsBean#copyProperties
     */
    public static void copyProperties(final Object dest, final Object orig, final String[] ingores)  {
        try{
            BeanUtilsBean.getInstance().copyProperties(dest, orig, ingores);
        }
        catch(IllegalAccessException | InvocationTargetException e)
        {
            throw new SystemRuntimeException("对象转换时失败" , e);
        }
    }
    
    public static void copyProperties(final Object dest, final Object orig)  {
        try{
            BeanUtilsBean.getInstance().copyProperties(dest, orig);
        }
        catch(IllegalAccessException | InvocationTargetException e)
        {
            throw new SystemRuntimeException("对象转换时失败" , e);
        }
    }
    
    
    /*========================================================================*
     *                         Private Methods (私有方法)                                                                   
     *========================================================================*/
}

